
def readgui():
    gui=open('hegeer_pbe0-13_POB-DZVP_2.gui','r')
    atoms=[]
    for line in gui:
        if len(line.split())==4:
            atoms.append(line.split()[0])
            
    S=[]
    P1=[]
    P2=[]
    P3=[]
    D=[]
    n=1
    tzvp={'1':(3,3),'6':(4,9,5),'7':(4,9,5),'16':(5,12)}
    for i in atoms:
        Sshell=tzvp[i][0]
        Pshell=tzvp[i][1]
        if len(tzvp[i])>2:
            Dshell=tzvp[i][2]
        S=S+[j for j in range(n,n+Sshell)]
        P1=P1+[j for j in range(n+Sshell,n+Sshell+Pshell,3)]
        P2=P2+[j for j in range(n+Sshell+1,n+Sshell+Pshell+1,3)]
        P3=P3+[j for j in range(n+Sshell+2,n+Sshell+Pshell+2,3)]
        D=D+[j for j in range(n+Sshell+Pshell,n+Sshell+Pshell+Dshell)]
        n=n+sum(tzvp[i])
    print len(P1)
    print ' '.join(map(str,P1))
    print len(P2)
    print ' '.join(map(str,P2))       
    print len(P3)
    print ' '.join(map(str,P3))  
    print len(S)
    print ' '.join(map(str,S))  
readgui()